let data = [
  { url: "../img/slideshow1.png", words: "什么？又反转了？", bc: "126, 147, 174" },
  { url: "../img/slideshow2.png", words: "预约《物华弥新》抽大会员&手办", bc: "213, 206, 120" },
  { url: "../img/slideshow3.png", words: "收下这份春日逛吃攻略！带话题投稿分万元贝壳金~", bc: "193, 86, 0" },
  { url: "../img/slideshow4.png", words: "出手两年前买的金条！一共涨了多少？", bc: "126, 147, 174" },
  { url: "../img/slideshow1.png", words: "什么？又反转了？", bc: "126, 147, 174" },
  { url: "../img/slideshow2.png", words: "预约《物华弥新》抽大会员&手办", bc: "213, 206, 120" },
  { url: "../img/slideshow3.png", words: "收下这份春日逛吃攻略！带话题投稿分万元贝壳金~", bc: "193, 86, 0" },
  { url: "../img/slideshow4.png", words: "出手两年前买的金条！一共涨了多少？", bc: "126, 147, 174" },
  { url: "../img/slideshow1.png", words: "什么？又反转了？", bc: "126, 147, 174" },
  { url: "../img/slideshow2.png", words: "预约《物华弥新》抽大会员&手办", bc: "213, 206, 120" }

]



const next = document.querySelector('.you');
const prev = document.querySelector('.zuo');
const img = document.querySelector(' .left1 img')

let i = 0

const li = document.querySelectorAll('li')



next.addEventListener('click', function () {
  i++

  if (i >= 10) {
    i = 0
  }
  console.log(i)
  img.src = data[i].url
  document.querySelector('.active10').classList.remove("active10")
  li[i].classList.add("active10")
})


prev.addEventListener('click', function () {
  i--

  if (i < 0) {
    i = 9
  }
  console.log(i)
  img.src = data[i].url
  document.querySelector('.active10').classList.remove("active10")
  li[i].classList.add("active10")
})







// function abc(i) {
//   if (i == 0) {
//     slideshowText.style.backgroundImage = `linear-gradient(rgba(126,147,174 , 0.3) 25% , rgba(126,147,174, 0.5) 50%,rgba(126,147,174, 0.75) 75%, rgba(126,147,174, 1) 100%)`
//   }
//   else if (i == 1) {
//     slideshowText.style.backgroundImage = `linear-gradient(rgba(213,206,120 , 0.3) 25% , rgba(213,206,120, 0.5) 50%,rgba(213,206,120, 0.75) 75%, rgba(213,206,120, 1) 100%)`
//   }
//   else if (i == 2) {
//     slideshowText.style.backgroundImage = `linear-gradient(rgba(193,86,0 , 0.3) 25% , rgba(193,86,0, 0.5) 50%,rgba(193,86,0, 0.75) 75%, rgba(193,86,0, 1) 100%)`
//   }
//   else if (i == 3) {
//     slideshowText.style.backgroundImage = `linear-gradient(rgba(126,147,174 , 0.3) 25% , rgba(126,147,174, 0.5) 50%,rgba(126,147,174, 0.75) 75%, rgba(126,147,174, 1) 100%)`
//   }
//   else if (i == 4) {
//     slideshowText.style.backgroundImage = `linear-gradient(rgba(15,26,131 , 0.3) 25% , rgba(15,26,131, 0.5) 50%,rgba(15,26,131, 0.75) 75%, rgba(15,26,131, 1) 100%)`
//   }
//   else if (i == 5) {
//     slideshowText.style.backgroundImage = `linear-gradient(rgba(40,34,34 , 0.3) 25% , rgba(40,34,34, 0.5) 50%,rgba(40,34,34, 0.75) 75%, rgba(40,34,34, 1) 100%)`
//   }
//   else if (i == 6) {
//     slideshowText.style.backgroundImage = `linear-gradient(rgba(126,37,3 , 0.3) 25% , rgba(126,37,3, 0.5) 50%,rgba(126,37,3, 0.75) 75%, rgba(126,37,3, 1) 100%)`
//   }
//   else if (i == 7) {
//     slideshowText.style.backgroundImage = `linear-gradient(rgba(156,171,194 , 0.3) 25% , rgba(156,171,194, 0.5) 50%,rgba(156,171,194, 0.75) 75%, rgba(156,171,194, 1) 100%)`
//   }
//   else if (i == 8) {
//     slideshowText.style.backgroundImage = `linear-gradient(rgba(54,42,42 , 0.3) 25% , rgba(54,42,42, 0.5) 50%,rgba(54,42,42, 0.75) 75%, rgba(54,42,42, 1) 100%)`
//   }
// }



// const liAll = document.querySelectorAll('.not-gray li');
// const one = document.querySelectorAll('.one')
// const two = document.querySelectorAll('.two')


// console.log(prev);

// // 对左右按钮的控制

// next.addEventListener('click', function () {
//   i++
//   i = i >= data.length ? 0 : i
//   document.querySelector('.slideshow-img img').src = data[i].url
//   document.querySelector('.slideshow-words').innerHTML = data[i].words
//   document.querySelector('.is-active').classList.remove("is-active")
//   if (document.querySelector('.after'))
//     document.querySelector('.after').classList.remove("after")
//   if (document.querySelector('.before'))
//     document.querySelector('.before').classList.remove("before")
//   if (document.querySelector('.reverseafter'))
//     document.querySelector('.reverseafter').classList.remove("reverseafter")
//   if (document.querySelector('.reversebefore'))
//     document.querySelector('.reversebefore').classList.remove("reversebefore")
//   liAll[i].classList.add("is-active")
//   one[i].classList.add("before")
//   two[i].classList.add('after')

//   abc(i)

// }, false);


// prev.addEventListener('click', function () {
//   i--
//   i = i < 0 ? data.length - 1 : i
//   document.querySelector('.slideshow-img img').src = data[i].url
//   document.querySelector('.slideshow-words').innerHTML = data[i].words

//   document.querySelector('.is-active').classList.remove("is-active")
//   if (document.querySelector('.after'))
//     document.querySelector('.after').classList.remove("after")
//   if (document.querySelector('.before'))
//     document.querySelector('.before').classList.remove("before")
//   if (document.querySelector('.reverseafter'))
//     document.querySelector('.reverseafter').classList.remove("reverseafter")
//   if (document.querySelector('.reversebefore'))
//     document.querySelector('.reversebefore').classList.remove("reversebefore")
//   liAll[i].classList.add("is-active")
//   one[i].classList.add("reversebefore")
//   two[i].classList.add("reverseafter")
//   abc(i)
// }, false);

// //自动播放效果
// let timeID = setInterval(function () {
//   next.click()
// }, 1000)

// const slideshowRegion = document.querySelector('.slideshow-region')
// console.log(slideshowRegion)

// slideshowRegion.addEventListener('mouseenter', function () {
//   clearInterval(timeID)
// }, false)

// slideshowRegion.addEventListener('mouseleave', function () {
//   clearInterval(timeID)

//   timeID = setInterval(function () {
//     next.click()
//   }, 1000)

// }, false)
